package com.sdkj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sdkj.mapper.UserMapper;
import com.sdkj.pojo.User;
import com.sdkj.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public boolean login(String username,String password)
    {
        LambdaQueryWrapper<User>lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(User::getUsername,username);
        User user=userMapper.selectOne(lambdaQueryWrapper);
        if(user==null){
            return false;

        }else {
            if(!password.equals(user.getPassword())){
                return false;
            }else {
                return true;
            }
        }
    }
}
